home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form FRM_Main
- Caption = "CSsample - VB Error Ease Sample Application"
- ClientHeight = 6720
- ClientLeft = 1110
- ClientTop = 330
- ClientWidth = 7365
- Height = 7125
- Icon = CSSAMPLE.FRX:0000
- Left = 1050
- LinkTopic = "Form1"
- ScaleHeight = 6720
- ScaleWidth = 7365
- Top = -15
- Width = 7485
- Begin CheckBox Check6
- Caption = "Delimited Output"
- Height = 255
- Left = 5520
- TabIndex = 30
- Top = 3120
- Width = 1815
- End
- Begin CheckBox Check5
- Caption = "Display Number"
- Height = 255
- Left = 5520
- TabIndex = 29
- Top = 2760
- Width = 1815
- End
- Begin CheckBox Check4
- Caption = "Memory Enabled"
- Height = 255
- Left = 5520
- TabIndex = 28
- Top = 3480
- Width = 1815
- End
- Begin CheckBox Check3
- Caption = "Message Literals"
- Height = 255
- Left = 5520
- TabIndex = 27
- Top = 2040
- Width = 1815
- End
- Begin CheckBox Check2
- Caption = "Handler Enabled"
- Height = 255
- Left = 5520
- TabIndex = 26
- Top = 1680
- Width = 1815
- End
- Begin CheckBox Check1
- Caption = "DeveloperMode"
- Height = 255
- Left = 5520
- TabIndex = 25
- Top = 2400
- Width = 1815
- End
- Begin CSerr CSerr1
- Prop25 = "Click on '...' for About Box."
- BypassLog = 0 'False
- DeveloperMode = 0 'False
- DisplayNumber = 0 'False
- ErrorBoxParameters= 0
- ErrorBoxResponse= 0
- ErrorBoxTitle = "CSsample VB Error Ease Sample"
- ErrorEXEName = ""
- ErrorLevel = 0
- ErrorLevelOVD = 0
- ErrorLine = 0
- ErrorLogName = "CSSAMPLE.LOG"
- ErrorLogText = ""
- ErrorMemoryEnabled= 0 'False
- ErrorMessage = ""
- ErrorMessageVB = ""
- ErrorModule = ""
- ErrorNumber = 0
- ErrorProcedure = ""
- ErrorResult = 0
- ErrorTableName = "CSSAMPLE.CSM"
- ErrorUserID = ""
- Left = 120
- LogEnabled = -1 'True
- LogFormat = 0 'Text
- LogOnly = 0 'False
- MessageLiteral = -1 'True
- TableEnabled = -1 'True
- Top = 4320
- UserLogField1 = ""
- UserLogField2 = ""
- UserLogField3 = ""
- UserLogField4 = ""
- UserLogField5 = ""
- UserLogTitle1 = "User Log Field:"
- UserLogTitle2 = "User Log Field:"
- UserLogTitle3 = "User Log Field:"
- UserLogTitle4 = "User Log Field:"
- UserLogTitle5 = "User Log Field:"
- End
- Begin CommandButton Command7
- Caption = "No VB Msg."
- Height = 375
- Left = 120
- TabIndex = 23
- Top = 1320
- Width = 1335
- End
- Begin TextBox Text1
- Height = 735
- Left = 240
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 22
- Text = "CSsample VB Error Ease log text."
- Top = 5880
- Width = 7095
- End
- Begin CommandButton Command12
- Caption = "Change Log"
- Height = 375
- Left = 120
- TabIndex = 20
- Top = 3000
- Width = 1335
- End
- Begin CommandButton Command11
- Caption = "Change Table"
- Height = 375
- Left = 120
- TabIndex = 19
- Top = 2640
- Width = 1335
- End
- Begin CommandButton Command6
- Caption = "Level OVD"
- Height = 375
- Left = 120
- TabIndex = 17
- Top = 960
- Width = 1335
- End
- Begin CommandButton Command5
- Caption = "Log Entry"
- Height = 375
- Left = 120
- TabIndex = 11
- Top = 1680
- Width = 1335
- End
- Begin OptionButton Option1
- Caption = "Neither"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Index = 0
- Left = 5760
- TabIndex = 16
- TabStop = 0 'False
- Top = 360
- Width = 1095
- End
- Begin OptionButton Option1
- Caption = "Log Only"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Index = 3
- Left = 5760
- TabIndex = 15
- TabStop = 0 'False
- Top = 1080
- Width = 1095
- End
- Begin OptionButton Option1
- Caption = "MSG Only"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Index = 2
- Left = 5760
- TabIndex = 14
- TabStop = 0 'False
- Top = 840
- Width = 1095
- End
- Begin OptionButton Option1
- Caption = "MSG+ LOG"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 255
- Index = 1
- Left = 5760
- TabIndex = 13
- TabStop = 0 'False
- Top = 600
- Value = -1 'True
- Width = 1095
- End
- Begin Frame Frame1
- Caption = "ERR Actions:"
- Height = 1335
- Left = 5640
- TabIndex = 12
- Top = 120
- Width = 1335
- End
- Begin CommandButton Command4
- Caption = "End"
- Height = 375
- Left = 120
- TabIndex = 10
- Top = 3600
- Width = 1335
- End
- Begin CommandButton Command3
- Caption = "VB Error"
- Height = 375
- Left = 120
- TabIndex = 9
- Top = 600
- Width = 1335
- End
- Begin CommandButton Command2
- Caption = "User Error"
- Height = 375
- Left = 120
- TabIndex = 8
- Top = 240
- Width = 1335
- End
- Begin Line Line1
- X1 = 1680
- X2 = 5400
- Y1 = 3720
- Y2 = 3720
- End
- Begin Label Label2
- Caption = "Log Text:"
- Height = 255
- Left = 240
- TabIndex = 24
- Top = 5640
- Width = 1215
- End
- Begin Label Label1
- Caption = "ErrorBoxResponse:"
- Height = 375
- Index = 9
- Left = 1680
- TabIndex = 21
- Top = 3240
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorResult:"
- Height = 375
- Index = 8
- Left = 1680
- TabIndex = 18
- Top = 2760
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorMessage Returned:"
- Height = 1095
- Index = 7
- Left = 1680
- TabIndex = 7
- Top = 4800
- Width = 5655
- End
- Begin Label Label1
- Caption = "ErrorLevel Returned:"
- Height = 375
- Index = 6
- Left = 1680
- TabIndex = 6
- Top = 4320
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorNumber Returned:"
- Height = 375
- Index = 5
- Left = 1680
- TabIndex = 5
- Top = 3840
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorLogText:"
- Height = 495
- Index = 4
- Left = 1680
- TabIndex = 0
- Top = 2160
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorLogName:"
- Height = 375
- Index = 3
- Left = 1680
- TabIndex = 4
- Top = 1680
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorTableName:"
- Height = 375
- Index = 2
- Left = 1680
- TabIndex = 3
- Top = 1200
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorLine:"
- Height = 375
- Index = 1
- Left = 1680
- TabIndex = 2
- Top = 720
- Width = 3615
- End
- Begin Label Label1
- Caption = "ErrorNumber:"
- Height = 375
- Index = 0
- Left = 1680
- TabIndex = 1
- Top = 240
- Width = 3615
- End
- Option Explicit
- Dim giNoVBmsg, gEndearly, gTrashValues As Integer
- Sub Check1_Click ()
- FRM_Main!CSerr1.DeveloperMode = Check1
- End Sub
- Sub Check2_Click ()
- FRM_Main!CSerr1.Enabled = Check2
- End Sub
- Sub Check3_Click ()
- FRM_Main!CSerr1.MessageLiteral = Check3
- End Sub
- Sub Check4_Click ()
- FRM_Main!CSerr1.ErrorMemoryEnabled = Check4
- End Sub
- Sub Check5_Click ()
- FRM_Main!CSerr1.DisplayNumber = Check5
- End Sub
- Sub Check6_Click ()
- FRM_Main!CSerr1.LogFormat = Check6
- End Sub
- Sub Command11_Click ()
- Dim szBuf As String
- szBuf = InputBox("Enter New Message Table Path and Name: ")
- If Len(szBuf) > 0 Then
- FRM_Main!CSerr1.ErrorTableName = szBuf
- End If
- End Sub
- Sub Command12_Click ()
- Dim szBuf As String
- szBuf = InputBox("Enter New History log file Path and Name: ")
- If Len(szBuf) > 0 Then
- FRM_Main!CSerr1.ErrorLogName = szBuf
- End If
- End Sub
- Sub Command2_Click ()
- Main_Process (2)
- End Sub
- Sub Command3_Click ()
- Main_Process (3)
- End Sub
- Sub Command4_Click ()
- End Sub
- Sub Command5_Click ()
- FRM_Main!CSerr1.ErrorLogText = Text1
- FRM_Main!CSerr1.ErrorModule = "CSSAMPLE.FRM"
- FRM_Main!CSerr1.ErrorProcedure = "Command5_Click"
- FRM_Main!CSerr1.BypassLog = True
- FRM_Main!CSerr1.LogOnly = True
- End Sub
- Sub Command6_Click ()
- Dim x As Integer
- x = InputBox("Enter Override value: ", "Error Override")
- FRM_Main!CSerr1.ErrorLevelOVD = x
- End Sub
- Sub Command7_Click ()
- giNoVBmsg = 1
- End Sub
- Sub CSerr1_ErrorLogSet ()
- '--->VB Error Ease<---Set the VB Error Information
- FRM_Main!CSerr1.ErrorLine = Erl
- FRM_Main!CSerr1.ErrorMessageVB = Error$(FRM_Main!CSerr1)
- '--->VB Error Ease<---End Of Block
- 'Code to demonstrate the User defined Log fields.
- CSerr1.UserLogTitle1 = "User Defined Title1"
- CSerr1.UserLogField1 = "SOME INFO TO PUT IN THIS FIELD1"
- CSerr1.UserLogTitle2 = "User Defined Title2"
- CSerr1.UserLogField2 = "SOME INFO TO PUT IN THIS FIELD2"
- CSerr1.UserLogTitle3 = "User Defined Title3"
- CSerr1.UserLogField3 = "SOME INFO TO PUT IN THIS FIELD3"
- CSerr1.UserLogTitle4 = "User Defined Title4"
- CSerr1.UserLogField4 = "SOME INFO TO PUT IN THIS FIELD4"
- CSerr1.UserLogTitle5 = "User Defined Title5"
- CSerr1.UserLogField5 = "SOME INFO TO PUT IN THIS FIELD5"
- ' Special code for Message Level Overrides
- Select Case FRM_Main!CSerr1.ErrorNumber
- Case 53 'illegal function call
- ' This is only overridable for the Command3_Click procedure.
- If FRM_Main!CSerr1.ErrorProcedure = "Main_Process" Then
- ' Change Message level to Warning.
- FRM_Main!CSerr1.ErrorLevelOVD = 11
- End If
- End Select
- End Sub
- Sub CSerr1_ErrorTrap (ErrorNumber As Integer, ErrorLevel As Integer, ErrorMessage As String, ErrorAction As Integer)
- On Error GoTo 0 ' This is needed to prevent looping.
- Label1(0) = "ErrorNumber: " & FRM_Main!CSerr1.ErrorNumber
- Label1(1) = "ErrorLine: " & FRM_Main!CSerr1.ErrorLine
- Label1(2) = "ErrorTableName: " & FRM_Main!CSerr1.ErrorTableName
- Label1(3) = "ErrorLogName: " & FRM_Main!CSerr1.ErrorLogName
- Label1(4) = "ErrorLogText: " & FRM_Main!CSerr1.ErrorLogText
- Label1(5) = "ErrorNumber Returned: " & ErrorNumber
- Label1(6) = "ErrorLevel Returned: " & ErrorLevel
- Label1(7) = "ErrorMessage Returned: " & ErrorMessage
- 'Label1(8) = "Error Message Property: " & FRM_Main!CSerr1.ErrorMessage
- If gTrashValues = 1 Then
- ErrorNumber = 0
- ErrorLevel = 0
- ErrorMessage = ""
- gTrashValues = 0
- End If
- If gEndearly = 1 Then
- gEndearly = 0
- End
- End If
- If option1(0) = True Then
- ErrorAction = CS_ACTION_IGNORE
- End If
- If option1(1) = True Then
- 'nothing do both msg and log...
- 'same as ErrAction = CS_ACTION_DEFAULT
- End If
- If option1(2) = True Then
- ErrorAction = CS_ACTION_MESSAGEONLY
- End If
- If option1(3) = True Then
- ErrorAction = CS_ACTION_LOGONLY
- End If
- End Sub
- Sub Exit_Application ()
- MsgBox "In the Exit_Application routine."
- End Sub
- Sub Form_Load ()
- '--->VB Error Ease<---Lock
- '--->VB Error Ease<---Set the local Error Log Trace Information.
- FRM_Main!CSerr1.ErrorProcedure = "Form_Load"
- FRM_Main!CSerr1.ErrorModule = "CSSAMPLE.FRM"
- 'Set Local Scope Error Trap
- On Error GoTo VBEASE_FORM_LOAD:
- '--->VB Error Ease<---End of Code Block
- 'Set the Network Application User ID.
- FRM_Main!CSerr1.ErrorUserID = "LAN ID"
- 'Set the Message Table name and location.
- FRM_Main!CSerr1.ErrorTableName = App.Path & "\" & FRM_Main!CSerr1.ErrorTableName
- 'Set the Histiry Log File name and location.
- FRM_Main!CSerr1.ErrorLogName = App.Path & "\" & FRM_Main!CSerr1.ErrorLogName
- 'Set Check box defaults
- Check1 = Abs(FRM_Main!CSerr1.DeveloperMode)
- Check2 = Abs(FRM_Main!CSerr1.Enabled)
- Check3 = Abs(FRM_Main!CSerr1.MessageLiteral)
- Check4 = Abs(FRM_Main!CSerr1.ErrorMemoryEnabled)
- Check5 = Abs(FRM_Main!CSerr1.DisplayNumber)
- Check6 = Abs(FRM_Main!CSerr1.LogFormat)
- '--->VB Error Ease<---Local Scope Error Block
- 'Normal Exit will Remove Local Error Trap.
- FORM_LOAD_EXIT:
- Exit Sub
- 'Error Block Entry Point
- VBEASE_FORM_LOAD:
- 'Invoke The VB Error Ease VBX.
- FRM_Main!CSerr1.ErrorNumber = Err
- 'Determine how and where to continue processing after this
- 'error has been handled by VB Error Ease.
- Select Case FRM_Main!CSerr1.ErrorResult
- Case CS_LOG_ONLY, CS_OK_LOW, CS_OK_HIGH, CS_YES_LOW, CS_YES_HIGH, CS_IGNORE_LOW, CS_IGNORE_HIGH
- Resume Next
- Case CS_RETRY_LOW, CS_RETRY_HIGH
- Resume
- Case CS_OK_FATAL, CS_ABORT_LOW, CS_ABORT_HIGH
- 'Invoke your VB Exit_Application routine.(Exit Cleanly)
- 'Replace the following Expicit End with a call to
- 'your Exit _Application routine.
- Exit_Application
- Case CS_DISABLED
- 'VB Error Ease is disabled, error must be trapped!
- Case Else
- Resume FORM_LOAD_EXIT
- End Select
- '--->VB Error Ease<---End of Code Block
- End Sub
- Sub Main_Process (iFeature As Integer)
- '--->VB Error Ease<---Lock
- '--->VB Error Ease<---Set the local Error Log Trace Information.
- FRM_Main!CSerr1.ErrorProcedure = "Main_Process"
- FRM_Main!CSerr1.ErrorModule = "CSSAMPLE.FRM"
- '--->Set Local Scope Error Trap.
- On Error GoTo VBEASE_MAIN_PROCESS
- '--->VB Error Ease<---End of Code Block
- 'Variable Declaration(s)
- Dim iMsg As String
- 'Choose the feature to demonstrate
- Select Case iFeature
- Case 2 'Process a User defined Message.
- iMsg = InputBox("Enter the user defined Message Number:", "User Message")
- 'Check for the Cancel Button
- If Len(iMsg) > 0 Then
- 'Set the log text to some usefull information.
- FRM_Main!CSerr1.ErrorLogText = Text1
- 'Note if a non-numeric is entered,VB Error Ease will handle the
- 60000
- 'VB Error 5 'illegal function call'.
- Error Val(iMsg)
- 'This is where Resume Next will send us.
- MsgBox "The program has performed a Resume Next."
- End If
- Case 3 'Process a VB defined Error
- INVALIDVBNUMBER:
- iMsg = InputBox("Enter the VB defined Error Number:", "VB Error")
- 'Check for the Cancel Button
- If Len(iMsg) > 0 Then
- 'Set the log text to some usefull information.
- FRM_Main!CSerr1.ErrorLogText = Text1
- 'Validtate the VB Error Range
- If Val(iMsg) < 1 Or Val(iMsg) > 10000 Then
- 'Invalid range, lets let VB Error Ease handle this message.
- Error ERR_INVALID_VB_NUMBER
- End If
- 'Note if a non-numeric is entered,VB Error Ease will handle the
- 'VB Error 5 'illegal function call'.
- Error Val(iMsg)
- End If
- End Select
- 'Set the labels for the Result Codes.
- Label1(8) = "ErrorResult: " & FRM_Main!CSerr1.ErrorResult
- Label1(9) = "ErrorBoxResponse: " & FRM_Main!CSerr1.ErrorBoxResponse
- 'Normal exit
- GoTo MAIN_PROCESS_EXIT
- 'Resume to Tag demo. code.
- TAG1:
- MsgBox "The program has resumed to the TAG1 tag."
- 'Set the labels for the Result Codes.
- Label1(8) = "ErrorResult: " & FRM_Main!CSerr1.ErrorResult
- Label1(9) = "ErrorBoxResponse: " & FRM_Main!CSerr1.ErrorBoxResponse
- '--->VB Error Ease<---Local Scope Error Block
- 'Normal Exit will Remove Local Error Trap.
- MAIN_PROCESS_EXIT:
- Exit Sub
- 'Error Block Entry Point
- VBEASE_MAIN_PROCESS:
- 'Invoke The VB Error Ease VBX.
- FRM_Main!CSerr1.ErrorNumber = Err
- 'Determine how and where to continue processing after this
- 'error has been handled by VB Error Ease.
- Select Case FRM_Main!CSerr1.ErrorResult
- Case CS_OK_LOW, CS_YES_LOW, MYEXPLICIT60
- Resume Next
- Case CS_ABORT_LOW, CS_ABORT_HIGH, CS_OK_FATAL, CS_NO_LOW, CS_NO_HIGH
- Exit_Application
- Case CS_RETRY_LOW, CS_RETRY_HIGH
- Resume
- Case CS_YES_HIGH
- Resume TAG1
- Case CS_OK_HIGH
- Resume INVALIDVBNUMBER
- Case CS_IGNORE_LOW, CS_IGNORE_HIGH
- Exit Sub
- Case CS_DISABLED
- 'VB Error Ease is disabled, error must be trapped!
- Case Else
- Resume MAIN_PROCESS_EXIT
- End Select
- '--->VB Error Ease<---End of Code Block
- End Sub
-